package com.example.semo.controller;

import com.example.semo.dao.CateChildDao;
import com.example.semo.entity.CateChild;
import com.example.semo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@ResponseBody
public class CateChildController {
        String msg;
        int code;
        @Autowired
        CateChildDao cateChildDao;
        @RequestMapping("/selectCateChild")
        public JsonResult selectLove(@RequestBody CateChild cateChild){
            List list=cateChildDao.SelectCateChild(cateChild);
            if(list==null||list.size()==0){
                code=500;
                msg="数据为空";
            }else {
                code=200;
                msg="分类子列表查询成功";
            }
            return new JsonResult(code,msg,list);
        }
}
